package com.douyang.controller;

import com.douyang.base.model.Result;
import com.douyang.model.OrderStatement;
import com.douyang.service.OrderStatementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xiaoma
 * @since 2025-04-22
 */
@RestController
@RequestMapping("/trade/orderStatement")
public class OrderStatementController {

    @Autowired
    private OrderStatementService orderStatementService;

    @PostMapping("/createOrderStatement/{orderId}")
    public Result<Long> createOrderStatement(@PathVariable Long orderId) {
        return Result.success(orderStatementService.createOrderStatement(orderId));
    }

    @GetMapping("/tryToPay")
    public Result<String> tryToPay(Long orderStatementId) {
        return Result.success(orderStatementService.tryToPay(orderStatementId));
    }

    @PostMapping("/payNotify")
    public String payNotify(@RequestParam Map<String,String> param) {
        return orderStatementService.payNotify(param);
    }
}
